<?php
$con = mysql_connect('localhost', 'root', 'root');
if (!$con) {
    die(mysql_error());
}
mysql_select_db('demo', $con);
$sql = "select * from demos";
$result = mysql_query($sql);
if (!$result) {
    die(mysql_error());
}
var_dump(mysql_fetch_array($result));
mysql_close($con);